#include "../header/Impala.h"

void Impala::deplacementImpala(int nb) {

	if (this->posX == 0) {
		while (nb > 0) {

			if (this->posY == 6) {
				this->posX = 1;
				this->posY = 7;
				nb--;
				deplacementImpala(nb);
				nb = 0;
			} else {
				this->posY++;
				nb--;
			}
		}
	} else if (this->posX == 6) {
		while (nb > 0) {
			if (this->posY == 1) {
				this->posX = 5;
				this->posY = 0;
				nb--;
				deplacementImpala(nb);
				nb = 0;
			} else {
				this->posY--;
				nb--;
			}
		}
	} else if (this->posY == 0) {
		while (nb > 0) {
			if (this->posX == 1) {
				this->posX = 0;
				this->posY = 1;
				nb--;
				deplacementImpala(nb);
				nb = 0;
			} else {
				this->posX--;
				nb--;
			}
		}
	} else if (this->posY == 7) {
		while (nb > 0) {
			if (this->posX == 5) {
				this->posX = 6;
				this->posY = 6;
				nb--;
				deplacementImpala(nb);
				nb = 0;
			} else {
				this->posX++;
				nb--;
			}
		}
	}
}


